"""
数据容器-通用操作
"""

# 通用操作
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
my_tuple = (1, 2, 3, 4, 5, 6, 7, 8, 9)
my_set = {1, 2, 3, 4, 5, 6, 7, 8, 9}
my_dict = {'a': 1, 'b': 2, 'c': 3}

# max
print(max(my_list))
print(max(my_tuple))
print(max(my_set))
print(max(my_dict))  # 字典比较的是key的大小，字符串按照ascii码进行比较

print("-----------------------------")

# min
print(min(my_list))
print(min(my_tuple))
print(min(my_set))
print(min(my_dict))

print("-----------------------------")

# 排序 全部转换为list
print(sorted(my_list, reverse=True))
print(sorted(my_tuple, reverse=True))
print(sorted(my_set, reverse=True))
print(sorted(my_dict, reverse=True)) # 字典转换成list，同样取的是key

print("-----------------------------")


# 转换成list
print(list(my_tuple))
print(list(my_set))
print(list(my_dict)) # 字典转换成list，同样取的是key
print("-----------------------------")

# 转换成tuple
print(tuple(my_tuple))
print(tuple(my_set))
print(tuple(my_dict)) # 字典转换成list，同样取的是key
print("-----------------------------")

# 转换成set
print(set(my_tuple))
print(set(my_set))
print(set(my_dict)) # 字典转换成list，同样取的是key
print("-----------------------------")

# 转换成str
print(str(my_tuple))
print(str(my_set))
print(type(str(my_dict))) # 字典转换成list，同样取的是key
